<template>
	<view class="content">
		<button @click="doScan(1)" style="background-color: #3c9cff;">
      <uni-icons type="scan" size="30" color="#fff"></uni-icons>
      扫码核销
    </button>
		<button style="background-color: #f46c6c;" @click="goKaikaPage">
      <uni-icons type="vip" size="30" color="#fff"></uni-icons>
      会员开卡
    </button>
		<button @click="doScan(0)" style="background-color: #5bc728;">
      <uni-icons type="fire" size="30" color="#fff"></uni-icons>
      扫码充值
    </button>
		<button @click="showTongji" style="background-color: #faae3e;">
      <uni-icons type="map" size="30" color="#fff"></uni-icons>
      经营统计
    </button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {

		},
		methods: {
      goKaikaPage() {
        uni.navigateTo({ url: '/pages/member-kaika/member-kaika' })
      },
      doScan(type) {
        uni.scanCode({
          success(res) {
            const mid = res.result
            
            console.log(type, res)
            
            uni.navigateTo({
              url: `/pages/member-detail/member-detail?id=${mid}&type=${type}`
            })
          }
        })
      },
      showTongji() {
        uni.showToast({
          title: '暂未开通！',
          icon: 'error'
        })
      }
		}
	}
</script>

<style scoped>
  page {
    height: 100%;
  }
  
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
    padding: 0 20rpx;
    height: 100%;
	}
  
  button {
    width: 100%;
    border: none;
    height: 200rpx;
    line-height: 200rpx;
    margin-bottom: 20rpx;
    font-size: 50rpx;
    color: #fff;
  }
  
  button:last-child {
    margin-bottom: 0;
  }
  
  .uni-icons {
    position: relative;
    top: 3px;
  }
</style>
